Data Services Developer's Guide : The XQuery Expression Editor
This page last changed on Jan 09, 2008 by tkatz.
eDocs Home > BEA AquaLogic Data Services Platform 3.0 Documentation > Data Services Developer's Guide
|
Type | Description | Example |
---|---|---|
Variable | A variable already defined in a For Each or Update block in the update map. $$root is a special predefined variable that refers to the root of the service's XML type. |
$ORDER_WITH_LINE_ITEM $CUSTOMER |
Constant | A numeric, string, or other constant. | "a" "12345" |
Constant Cast | A constant cast to another XSD data type using the parentheses operator. | xsd:date("2007-01-01") |
Function | A call to any XQuery function. You can see the built-in and BEA-provided functions in the Design Palette. You can use a variable, path, or constant as an argument to a function. |
fn-bea:value($CUSTOMER/FIRST_NAME) |
Path | An expression that locates an XML element in a tree using variables, elements, and attributes. The syntax is: $VARIABLE_NAME /elementName @attributeName |
$ORDER_WITH_LINE_ITEM/CUSTOMER_ORDER/ORDER_ID |
Namespace prefixes are declared in the data service's XQuery source, which you can see in the Source tab. If a namespace is only used in the update map, and not in the logical data service, you must declare it. If a namespace cannot be resolved, it is shown with the prefix ns?.
The most common ways you use the expression editor are to:
A mapping between an element in a return type and an element in an update block uses the fn-bea:value function with a path name, for example:
fn-bea:value($CUSTOMER/CUSTOMER_ID)
An update mapping should always use fn-bea:value, whether ALDSP auto-generates the mapping or you draw it. If you remove the fn:bea:value function from the expression and simply use an XQuery path expression ($CUSTOMER/CUSTOMER_ID), the element becomes disabled in the update map and you see this error message:
The expression does not match the expected type for this element
The expression assigned to this element is not valid
Hint: did you forget to use the value function?
The fn-bea:value function is required, because an update map updates a Service Data Object (SDO) and requires a special XML structure called a datagraph that includes a change summary showing both the old and new values. The fn-bea:value function handles the update to the SDO correctly.
If you do not use fn-bea:value, ALDSP throws an exception when you attempt to update the value.
Contact BEA | Feedback | Privacy | (c) 2008 BEA Systems
Contact BEA | Feedback | Privacy | (c) 2008 BEA Systems
![]() |
Document generated by Confluence on Jan 15, 2008 11:02 |